import com.qi.dao.UserMapper;
import com.qi.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

/**
 * @author zjq
 * @date 2020/3/11 15:46
 */
public class UserMapperText {
    @Test
    public void test() {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //底层应用反射
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
//        List<User> users = mapper.getUsers();
//        for(User user:users){
//            System.out.println(user);
//        }
//        User userByID = mapper.getUserByID(1);
//        System.out.println(userByID);
        //插入语句
        //mapper.addUser(new User(7,"爱吃但","22525"));
        //修改语句
        //mapper.updateUser(new User(6,"sss","22525"));
        //删除语句
        mapper.deltetUser(6);
        sqlSession.commit();
        sqlSession.close();
    }

}
